<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commonjsp/jstl.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>抢工单管理平台</title>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<link rel="stylesheet" type="text/css" href="${prefix}/stylesheets/theme.css">
<link rel="stylesheet" type="text/css" href="${prefix}/stylesheets/reveal.css">
<link rel="stylesheet" type="text/css" href="${prefix}/lib/font-awesome/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="${prefix}/lib/bootstrap/css/bootstrap.css">

<script src="${prefix}/lib/jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="${prefix}/lib/ajaxfileupload.js" type="text/javascript"></script>
<script src="${prefix}/lib/jquery-form.js" type="text/javascript"></script>
<script src="${prefix}/lib/jquery.reveal.js" type="text/javascript"></script>
<!-- Demo page code -->
<style type="text/css">
#line-chart {
	height:300px;
	width:800px;
	margin: 0px auto;
	margin-top: 1em;
}

.brand { font-family: georgia, serif; }
.brand .first {
	color: #ccc;
	font-style: italic;
}

.brand .second {
	color: #fff;
	font-weight: bold;
}
</style>
<script type="text/javascript">
//查看指定公司下的店面信息（注意，只是查看！）
function storeDetails(companyid , companyName) {
	$("#storeDetailsDiv").html("");
	$("#myStoreDiv_companyname").html("公司：" + companyName + "下的店铺信息");
	$.ajax({
		type: "post",
		async: true,
		url: "${prefix}/storefront/queryStorefrontList?companyid=" + companyid,
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			var listDatas = jsonData.data;
			
			for(var index = 0 ; listDatas != null && index < listDatas.length ; index++) {
				var tdItem = listDatas[index];
				
				var tdhtml = "<tr>";
				tdhtml += "<td>" + (index + 1) + "</td>";
				tdhtml += "<td>" + tdItem.storeName + "</td>";
				tdhtml += "<td>" + tdItem.storePhone + "</td>";
				tdhtml += "<td>" + tdItem.createTime + "</td>";
				if(tdItem.status == 1) {
					tdhtml += "<td> 正常 </td>";
				} else {
					tdhtml += "<td style=\"color:#FF0000\"> 作废 </td>";
				}
				tdhtml += "<tr>";
				
				$("#storeDetailsDiv").append(tdhtml);
			}
		}
	});
}
</script>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
	<script src="${prefix}/javascripts/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="${prefix}/lib/font-awesome/docs/assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" href="${prefix}/lib/font-awesome/docs/assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="${prefix}/lib/font-awesome/docs//assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="${prefix}/lib/font-awesome/docs//assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="${prefix}/lib/font-awesome/docs//assets/ico/apple-touch-icon-57-precomposed.png">
</head>

<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7"> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8"> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> 
<body>
<!--<![endif]-->

<div class="navbar">
	<%@ include file="/commonjsp/userbar.jsp"%>
</div>

<div class="container-fluid">
	<div class="row-fluid">
		<%@ include file="/commonjsp/mainmenu.jsp"%>
		
		
		<!-- 列表 -->
		<div class="span9">
			<!-- 列表头 -->
			<h1 class="page-title">公司及门店</h1>
			<div class="btn-toolbar">
				<a href="${prefix}/company/preCompanyModify" class="btn btn-primary" ><i class="icon-plus"></i> 新建公司</a>
				<!-- button class="btn">删除</button -->
				<div class="btn-group"></div>
			</div>
			
			<!-- 列表正文 -->
			<div class="well">
				<table class="table">
					<thead>
						<tr>
							<th>#</th>
							<th>公司名称</th>
							<th>行业类型</th>
							<th>创建时间</th>
							<th>公司状态</th>
							<th style="width: 100px;">操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${companys}" var="company" varStatus="index">
						<tr>
							<td align="center">${index.index + 1}</td>
							<td>
								<c:choose>
								<c:when test="${company.companyURL == null || company.companyURL == ''}">
									<img src="${prefix}/images/defaultcompany.png" style="width: 32px"/>
								</c:when>
								<c:otherwise>
									<img src="${company.companyURL}"/>
								</c:otherwise>
								</c:choose>
								${company.companyName}
							</td>
							<td align="center" style="width: 200px">
								<c:choose>
								<c:when test="${company.industryType == 101 }"> KTV </c:when>
								<c:when test="${company.industryType == 102 }">酒店住宿</c:when>
								<c:when test="${company.industryType == 103 }"> 夜场 </c:when>
								<c:when test="${company.industryType == 104 }"> 其他 </c:when>
								</c:choose>
							</td>
							<td align="center" style="width: 200px">
								<fmt:formatDate value="${company.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
							</td>
							<td align="center">
								<c:choose>
								<c:when test="${company.status == 1 }"><label>正常</label></c:when>
								<c:otherwise><label style="color: #FF0000">作废</label></c:otherwise>
								</c:choose>
							</td>
							<td align="center">
								<a href="javascript:void(0);" onclick="storeDetails('${company.uid}','${company.companyName }')" title="店面详情" style="margin-right: 10px" data-reveal-id="myStoreDiv"><img src="${prefix}/images/details.png"></a>
								<a href="${prefix}/company/preCompanyModify?companyid=${company.uid}" title="编辑" style="margin-right: 10px"><i class="icon-pencil"></i></a>
								<c:choose>
								<c:when test="${company.status == 1 }">
								<a href="${prefix}/company/updateCompanyStatus?companyid=${company.uid}" title="作废" style="margin-right: 10px"><img src="${prefix}/images/delete.png"></a>
								</c:when>
								<c:otherwise>
								<a href="${prefix}/company/updateCompanyStatus?companyid=${company.uid}" title="启用" style="margin-right: 10px"><img src="${prefix}/images/yes2.png"></a>
								</c:otherwise>
								</c:choose>
							</td>
						</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</div>
	</div>
	
	<!-- Le javascript
	================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
	<script src="${prefix}/lib/bootstrap/js/bootstrap.js"></script>
	
	<!-- 查看文本信息的弹出层 -->
	<div id="myStoreDiv" class="reveal-modal" style="width: 720px;height: 360px; overflow-x: hidden; overflow-y: hidden">
		<font color="#999999" id="myStoreDiv_companyname"></font><br/>
		<table class="table">
			<thead>
				<tr>
					<th>#</th>
					<th>店面名称</th>
					<th>联系电话</th>
					<th>创建时间</th>
					<th>店面状态</th>
				</tr>
			</thead>
			<tbody id="storeDetailsDiv">
				
			</tbody>
		</table>
		<a class="close-reveal-modal">×</a>
	</div>
</div>
</body>
</html>